﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HFController;
namespace HFWebApp.lawyeruser
{
    public partial class lawyer : BagePages
    {
        public hf.Model.Lawyer model = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string idstr = this.GetQuery("id");
                if (idstr == "")
                {
                    Response.Write("参数错误");
                    Response.End();
                }
                else
                {
                    int id = int.Parse(idstr);

                    model = LawyerController.getController().getLawyerModel(id);
                    if (model == null)
                    {
                        Response.Write("参数错误");
                        Response.End();
                    }

                    //咨询我的问题
                    //8个
                    int total;
                    Repeater1.DataSource = LawyerController.getController().getLawyerNoteList(8, 1, "LawyerID=" + model.ID.ToString(), out total);
                    Repeater1.DataBind();

                    string strWherePara = AnswerController.getController().getAnswerAskIDList(model.ID);
                    string strWhere  = "ID in (0)";
                    if(strWherePara != "")
                        strWhere = "ID in (" + strWherePara + ")";

                    Repeater2.DataSource = AskController.getController().getAskList(8, 1, strWhere, out total, "ID");
                    Repeater2.DataBind();

                    Repeater3.DataSource = ArticleController.getController().getArticleList(8, 1, "", out total);
                    Repeater3.DataBind();
                }
            }
        }
    }
}